package com.dianrui.agent.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dianrui.agent.R;
import com.dianrui.agent.bean.MsgList;
import com.dianrui.agent.bean.OrderList;

import java.util.List;

public class MessageNewListAdapter extends BaseQuickAdapter<MsgList,BaseViewHolder> {
    private Context context;

    public MessageNewListAdapter(int layoutResId, @Nullable List<MsgList> data,Context context) {
        super(layoutResId, data);
        this.context=context;
    }

    @Override
    protected void convert(BaseViewHolder helper, MsgList msgList) {
        helper.setText(R.id.title,msgList.title);
        helper.setText(R.id.create_time,msgList.create_time);
        helper.setText(R.id.contents,msgList.contents);
        if ("1".equals(msgList.is_read)) {
            helper.setTextColor(R.id.title,context.getResources().getColor(R.color.gray));
            helper.setTextColor(R.id.create_time,context.getResources().getColor(R.color.gray));
            helper.setTextColor(R.id.contents,context.getResources().getColor(R.color.gray));
            helper.getView(R.id.show_msg_reddot).setVisibility(View.GONE);//已读的不显示红点
        }else {
            helper.setTextColor(R.id.title,context.getResources().getColor(R.color.black));
            helper.setTextColor(R.id.create_time,context.getResources().getColor(R.color.black));
            helper.setTextColor(R.id.contents,context.getResources().getColor(R.color.black));
            helper.getView(R.id.show_msg_reddot).setVisibility(View.VISIBLE);
        }
    }
}
